package com.guigu.dh.nuxt.controller;

import com.guigu.dh.common.result.Result;
import com.guigu.dh.service.DepartmentService;
import com.guigu.dh.service.HospitalService;
import com.guigu.dh.vo.hosp.HospitalQueryVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "用户界面医院信息接口")
@RestController
@RequestMapping("/admin/hosp/nuxtHospital")
public class NuxtHospitalController {

    @Autowired
    private HospitalService hospitalService;
    @Autowired
    private DepartmentService departmentService;

    @ApiOperation("查询医院信息列表")
    @PostMapping("/list/{currentPage}/{limit}")
    public Result showHospitalPage(@PathVariable Integer currentPage,
                                   @PathVariable Integer limit,
                                   @RequestBody HospitalQueryVO hospitalQueryVO){
        Result result = hospitalService.selectPage(currentPage,limit,hospitalQueryVO);

        return result;
    }

    @ApiOperation("根据医院名称查询")
    @GetMapping("/findHospitalByHosname/{hosname}")
    public Result findHospitalByHosname(@PathVariable String hosname){
        return hospitalService.findHospitalByHosname(hosname);
    }

    @ApiOperation("根据医院编号查询医院详情信息")
    @GetMapping("/findOneHospitalAllInfo/{hoscode}")
    public Result findOneHospitalAllInfo (@PathVariable String hoscode) {
        return Result.ok(hospitalService.getHospitalInfo(hoscode));
    }

    @ApiOperation("根据医院编号查询医院科室信息")
    @GetMapping("/findDepartmentByHoscode/{hoscode}")
    public Result findDepartmentByHoscode(@PathVariable String hoscode){
        return departmentService.queryDepartmentByHoscode(hoscode);
    }


}
